x11: Keep the drag window alive longer
authorMatthias Clasen <mclasen@redhat.com>
Fri, 8 Jan 2016 16:29:58 +0000 (11:29 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 8 Jan 2016 16:33:24 +0000 (11:33 -0500)
We destroy the widget that is wrapped around the drag window
when the object data on the drag context gets cleared. Destroying
the window before that happens leads to unpleasantries. E.g. we may
try to access the frame clock, which doesn't exist anymore, and
things go downhill from there. So, keep the window alive for
a little longer.

gdk/x11/gdkdnd-x11.c

index 6bc87c43c23bc5f6bed353bf2553efb81d3d4272..dd0725262c0e11b25a717f8ebee5bf7838f93fd6 100644 (file)
@@ -223,6 +223,7 @@ gdk_x11_drag_context_finalize (GObject *object)
 {
   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
   GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (object);
+  GdkWindow *drag_window;
 
   if (context->source_window)
     {
@@ -235,7 +236,12 @@ gdk_x11_drag_context_finalize (GObject *object)
 
   contexts = g_list_remove (contexts, context);
 
+  drag_window = context->drag_window;
+
   G_OBJECT_CLASS (gdk_x11_drag_context_parent_class)->finalize (object);
+
+  if (drag_window)
+    gdk_window_destroy (drag_window);
 }
 
 /* Drag Contexts */